package com.blog.dazi.Controller;

import com.blog.dazi.Service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/dazi/user")
@Api(tags = "用户接口")
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("findByTel")
    @ApiOperation(value = "根据电话获取用户信息")
    public Map<String,Object> findByTel(@ApiParam(value = "用户电话", required = true) String tel){
        return userService.findByTel(tel);
    }

    @GetMapping("findUserAllByTel")
    public Map<String,Object> findUserAllByTel(String tel){
        return userService.findUserAllByTel(tel);
    }

    @GetMapping("findUserAllByUserId")
    public Map<String,Object> findUserAllByUserId(String userId){
        return userService.findUserAllByUserId(userId);
    }

    /**
     * 根据搭子号查询用户
     * @param daziNumber
     * @return
     */
    @GetMapping("findUserByDaziNumbere")
    public Map<String,Object> findUserByDaziNumbere(String daziNumber){
        return userService.findUserByDaziNumbere(daziNumber);
    }

    @PostMapping("updatePhoto")
    public int updatePhoto(@RequestBody String user){
        return userService.updatePhoto(user);
    }



}
